#include <QCoreApplication>
#include "jp.h"
#include "sample.h"
#include "payload.h"
#include <QDebug>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    jp aha;
    // aha.load("../../save.json");
    sample *sam = nullptr;
    {
        auto in = getPayload();
        qDebug() << ">" << in << "\n" << in.toHex(':');
        sam = (sample*)in.data();
        sam = new sample(*sam);
        sam->print();
    }
    if(sam != nullptr)
    {
        sam->setRgb(0b101);
        double longitude = sam->getLongitude();
        sam->setLongitude(longitude);
        sam->print();
        char* data = reinterpret_cast<char*>(sam);
        QByteArray out(data, sizeof(sample));
        qDebug() << ">" << out << "\n" << out.toHex(':');
        delete sam;
    }
    return a.exec();
}
